namespace Backend.Data.BackendDataContextMigrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddCityStateTables : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Citys",
                c => new
                    {
                        Id = c.Guid(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        StateId = c.Guid(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.States", t => t.StateId)
                .Index(t => t.StateId);
            
            CreateTable(
                "dbo.States",
                c => new
                    {
                        Id = c.Guid(nullable: false, identity: true),
                        Name = c.String(),
                        Abbreviation = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Citys", "StateId", "dbo.States");
            DropIndex("dbo.Citys", new[] { "StateId" });
            DropTable("dbo.States");
            DropTable("dbo.Citys");
        }
    }
}
